// pages/order/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tabs:[
      {
        id:0,
        name:"全部订单",
        isActive:true
      },
      {
        id:1,
        name:"待付款",
        isActive:false
      },
      {
        id:3,
        name:"待收货",
        isActive:false
      },
      {
        id:3,
        name:"退后/退货",
        isActive:false
      }
    ],
  },  
  onLoad(option){ 
    let index = option.type
    let {tabs} = this.data
    console.log(index); 
    tabs.forEach( (v,i)=> i == index ? v.isActive = true : v.isActive = false )
    this.setData({
      tabs
    })
  },
  // 获取小标
  getitemIndex(e){ 
    let { index } = e.detail
    let {tabs} = this.data 
    tabs.forEach( (v,i) => { i == index ? v.isActive = true : v.isActive = false } )
    this.setData({
      tabs
    })
  },
})